package com.ke.video_clip.lib

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Parcelable
import androidx.activity.result.contract.ActivityResultContract
import kotlinx.parcelize.Parcelize

class ClipVideo : ActivityResultContract<ClipVideoRequest, Boolean>() {
    override fun createIntent(context: Context, input: ClipVideoRequest): Intent {
        val intent = Intent(context, VideoClipActivity::class.java)
        intent.putExtra(VideoClipActivity.EXTRA_REQUEST, input)
        return intent
    }

    override fun parseResult(resultCode: Int, intent: Intent?): Boolean {
        return resultCode == Activity.RESULT_OK
    }
}

@Parcelize
data class ClipVideoRequest(
    /**
     * 原视频路径
     */
    val source: String,
    /**
     * 保存的路径
     */
    val save: String
) : Parcelable